/**
 * @param {string} s
 * @return {boolean}
 */
 var checkPartitioning = function(s) {
    function checkReverse(str){
      let i=0,j=str.length-1
      while(i<=j){
        if(str[i]==str[j]){
          i++
          j--
        }else return false
      }
      return true

    }
   
      for(let j=1;j<s.length-1;j++){
        for(let k=j+1;k<s.length;k++){
          let str1 = s.substring(0,j)
          let str2 = s.substring(j,k)
          let str3 = s.substring(k)
          if (checkReverse(str1)&&checkReverse(str2)&& checkReverse(str3)) return true
        }
        
      }
    
      
    return false
};

checkPartitioning("babbaaaaab")